|
|
|
|
|
|
|
These may seem to be obscure steps, but once you are done, you can draw on the form you normally would if the program were running as a normal screen saver instead of in preview mode. |
|
|
|
|
|
|
|
|
Example program SSaver uses these steps to display a bouncing ball screen saver. The following code shows the Main subroutine that starts the program. |
|
|
|
 |
|
|
|
|
' Start the program. Public Sub Main()
Dim args As String
Dim preview_hwnd As Long
Dim preview_rect As RECT
Dim window_style As Long
' Get the command line arguments. args = LCase$(Trim$(Command$))
' Examine the first 2 characters. Select Case Left$(args, 2)
Case "/c" ' Display configuration dialog. RunMode = rmConfigure
Case "", "/s" ' Run as a screen saver. RunMode = rmScreenSaver
Case "/p" ' Run in preview mode. RunMode = rmPreview
Case Else ' This shouldn't happen. RunMode = rmScreenSaver
End Select
Select Case RunMode
Case rmConfigure ' Display configuration dialog. frmConfig.Show
Case rmScreenSaver ' Run as a screen saver.
' Make sure there isn't another one running. CheckShouldRun
' Display the cover form. frmCover.Show
ShowCursor False
Case rmPreview ' Run in preview mode.
' Set the caption for Windows 95. Load frmCover
frmCover.Caption = "Preview"
' Get the current window style. window_style = GetWindowLong(frmCover.hwnd, _
GWL_STYLE)
' Add WS_CHILD to make this a child window. |
|
|
|
|
|